package ae.pcfc.etks.online.common.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * ServiceDept entity. @author Mohtisham.Salahria
 */
@Entity
@Table(name = "T_ETKS_SERVICE_DEPT", schema = "ETKS_ONLINE_DBA", uniqueConstraints = @UniqueConstraint(columnNames = {
		"S_DEPT_CODE", "SERVICE_ID" }))
@SequenceGenerator(name = "SQ_ETKS_SERVICE_DEPT", sequenceName = "SQ_ETKS_SERVICE_DEPT", initialValue = 1, allocationSize = 1)
public class ServiceDept implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Long SDeptId;
	private Service Service;
	private String sDeptCode;

	// Constructors

	/** default constructor */
	public ServiceDept() {
	}

	/** full constructor */
	public ServiceDept(Service Service,
			String sDeptCode) {
		this.Service = Service;
		this.sDeptCode = sDeptCode;
	}	
	
	@Id
	@GeneratedValue( strategy = GenerationType.SEQUENCE, generator="SQ_ETKS_SERVICE_DEPT")
	@Column(name = "S_DEPT_ID", nullable = false, precision = 11, scale = 0)
	public Long getSDeptId() {
		return this.SDeptId;
	}

	public void setSDeptId(Long SDeptId) {
		this.SDeptId = SDeptId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SERVICE_ID", nullable = false)
	public Service getService() {
		return this.Service;
	}

	public void setService(Service Service) {
		this.Service = Service;
	}

	@Column(name = "S_DEPT_CODE", nullable = false, length = 5)
	public String getSDeptCode() {
		return this.sDeptCode;
	}

	public void setSDeptCode(String sDeptCode) {
		this.sDeptCode = sDeptCode;
	}

}